import {http} from '../utils/http';
import {SealCreateReq, SealItem} from "../types/api";

/**
 * 获取拥有印章的部门列表
 */
export function getDeptList() {
    return http.get('/seal/seal/get-sealdept');
}

/**
 * 获取印章列表
 */
export function getSealList(params: { orgId: number }) {
    return http.get<{ list: SealItem[] }>(`/seal/seal/page`, {...params, isAPP: true});
}

export function getSealInfo(params: { id: number }) {
    return http.get<{ list: SealItem[] }>(`/bpm/seal/get?id=${params.id}`);
}

/**
 * 获取精简的部门列表
 */
export function getDeptSimpleList() {
    return http.get('app/dept/simple-list');
}

export function sealCreate(data: SealCreateReq) {
    return http.post('bpm/seal/create', data);
}

export function sealUpdate(data: SealCreateReq) {
    return http.put('/seal/seal_apply/update', data);
}

export function getMySeal(data: any) {
    return http.get(`bpm/seal/page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`,);
}

export function getTodo(data: any) {
    return http.get(`bpm/seal/todo-page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`);
}

export function getDone(data: any) {
    return http.get(`bpm/seal/done-page?pageNo=${data.pageNo}&pageSize=${data.pageSize}`);
}